<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father {
            margin: 100px auto;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 200px;
            height: 200px;
            background-color: pink;
        }
        
        .son {
            width: 150px;
            height: 150px;
            background-color: rebeccapurple;
            color: white;
            font-size: 20px;
            line-height: 150px;
            text-align: center;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="son">son盒子</div>
    </div>
    <script>
        // 1.冒泡阶段 如果addEventListener第三个参数是false或者省略 那么则处于冒泡阶段 相反
        var son = document.querySelector('.son');
        son.addEventListener('click', function(e) {
            alert('son');
            // e.stopPropagation(); // stop停止 Propagation 传播 常规做法
            // e.cancelBubble = true; //cancle取消 bubble泡泡 传统做法
        }, false);

        var father = document.querySelector('.father');
        father.addEventListener('click', function(e) {
            alert('father');
            // e.stopPropagation();
        }, false);

        document.addEventListener('click', function() {
            alert('document');
        }, true);
    </script>
</body>

</html>